# Line colors and style, to assist standardization across the book

lineTypes <- function(n) {
  
  rep(c("solid", "dotdash", "dashed", "dotted"), length.out = n)
}

lineColors <- function(n) {
  
  nTypes <- length(unique(lineTypes(n)))
  rep(gray.colors(n / nTypes, start = 0, end = .7), each = nTypes)[1:n]
}


titlePage <- function(description, intro = TRUE) { 
  
  description = if (intro) paste0("On the next page:\n\n", description) else description
  
  plot(0,0, type = "n", bty = "n", axes = FALSE, xlab = "", ylab = "", xlim = c(0,1), ylim = c(0,1))
  text(0.5, .8, labels = description, cex = 2.5, pos = 1)
}

descriptionPage <- function(description) { 
  
  plot(0,0, type = "n", bty = "n", axes = FALSE, xlab = "", ylab = "", xlim = c(0,1), ylim = c(0,1))
  text(0, .5, labels = description, cex = .8, pos = 4)
}
